# Stage 1: Build Vue app
FROM swr.cn-south-1.myhuaweicloud.com/cpa/node:16 as build-stage
WORKDIR /app
COPY package*.json ./
COPY . .
# RUN yarn install --registry https://registry.npm.taobao.org
RUN yarn install --registry http://registry.npmmirror.com
RUN yarn build

# Stage 2: Serve Vue app with Nginx
FROM swr.cn-south-1.myhuaweicloud.com/cpa/nginx:1.25.1 as prod-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY --from=build-stage /app/server.conf /etc/nginx/conf.d/

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
